﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.ServiceModel;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using MarsExplorerServer.Classes;


namespace MarsExplorerServer
{
    public partial class Form1 : Form
    {
      
        public readonly SynchronizationContext formSyncContext;

        public Label LabelToUpdate
        {
            get
            {
                return this.label1;
            }
        }
        public Label LabelToUpdate2
        {
            get
            {
                return this.label2;
            }
        }

        public Form1()
        {
            InitializeComponent();
            this.formSyncContext = SynchronizationContext.Current;


           

        }

        private void button1_Click(object sender, EventArgs e)
        {
            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("http://127.0.0.1:8095/MarsExplorer/Service1/ping2");
            request.ContentType = "application/json; charset=utf-8";
            request.Accept = "application/json, text/javascript, */*";
            request.Method = "GET";
            

            WebResponse response = request.GetResponse();
            Stream stream = response.GetResponseStream();
            string json = "";

            using (StreamReader reader = new StreamReader(stream))
            {
                while (!reader.EndOfStream)
                {
                    json += reader.ReadLine();
                }
            }
            textBox1.Text = json;
        }
    }
}
